package com.breeze.tree;

public class MyClass {
    public static void main(String[] args) {
//        testBinarySortTree();
        testAVLTree();
    }

    private static void testAVLTree() {
        AVLTree tree = new AVLTree();
        // 3,2,1,4,5,6,7,10,9,8
        tree.addData(3);
        tree.addData(2);
        tree.addData(1);
        tree.addData(4);
        tree.addData(5);
        tree.addData(6);
        tree.addData(7);
        tree.addData(10);
        tree.addData(9);
        tree.addData(8);
        tree.showLevelOrder(); // TODO: 5 8 10 输出顺序问题
    }

    private static void testBinarySortTree() {
        BinarySortTree tree = new BinarySortTree();
        tree.addData(56);
        tree.addData(-8);
        tree.addData(0);
        tree.addData(127);
        tree.addData(6);
        tree.addData(44);
        tree.addData(21);
        tree.addData(7);
        tree.addData(-3);
        tree.addData(-100);
        tree.addData(99);
        // 通过中序遍历就可以按照从小到大的顺序排列
        tree.showMiddleOrder();
    }
}
